home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / sys / amiga / programmer / 7517 < prev    next >
Encoding:
Text File  |  1996-08-05  |  2.2 KB  |  53 lines

  1. Path: mn5.swip.net!news
  2. From: dan.eriksson@vxjkatedral.se (Peter Liljenberg)
  3. Newsgroups: comp.sys.amiga.programmer
  4. Subject: Re: Deleting Gadtools gads
  5. Date: 18 Apr 1996 08:18:23 GMT
  6. Organization: VΣxj÷ Katedralskola
  7. Message-ID: <4l4tsf$st6@mn5.swip.net>
  8. References: <4l2v15$p58@mercury.dur.ac.uk>
  9. Reply-To: dan.eriksson@vxjkatedral.se (Peter Liljenberg)
  10. NNTP-Posting-Host: tty17-01.swipnet.se
  11. X-Newsreader: WinVN 0.92.2
  12.  
  13. In article <4l2v15$p58@mercury.dur.ac.uk>, M D Sergeant <M.D.Sergeant@durham.ac.uk> says:
  14. >
  15. >How do I delete a gadtools gad from a window, I have tried alsorts, but all I
  16. >get is the gadget becomes just an image, and clicking does nothing. If I resize
  17. >the window to really small and then enlarge it it goes away. At the moment I
  18. >call gfx.library:EraseRect(); to get rid of it - surely this is wrong?
  19. >
  20. >Thanks for any help.
  21. >
  22. >Matt.
  23. >
  24.  
  25. You have done a small part of all that is needed to be done. You need to 
  26. remove the gadget from the window's gadgetlist as well. Use RemoveGadget()
  27. for this, but since a gadtools gadget might contain several standard 
  28. gadgets you can't be sure how many gadgets to remove. There's two ways of
  29. solving this:
  30. 1) Add the gadget you want to remove later last when you create the gadget.
  31. Now you can use RemoveGList(win, gadget, NULL, -1) [I'm not sure of the 
  32. argument order). win is your window, gadget is the one to remove, NULL is
  33. a pointer to an requester window (don't care about it) and -1 means that 
  34. you should remove all the gadgets in the list from gadget.
  35. 2) Remove all gadgets with RemoveGList(win, gadgetcontext, NULL, -1).
  36. gadgetcontext is the gadget set by CreateContext() [Note, don't remove
  37. ALL the windows gadget by using NULL since this will remove the system
  38. gadgets as well.] When all gadgets is removed, create the gadgets again
  39. but skip the gadgets you want to remove.
  40.  
  41. After having done either 1 or 2 above, you should now use EraseRect() on 
  42. the whole window area (if you mess with the borders you must use 
  43. RefreshWindowFrame() too), RefreshGList(), and GT_RefreshWindow().
  44.  
  45. The gadget is gone with the blitter!
  46.  
  47. Method 2 is also used when you have gadgets that adjusts themselves to 
  48. the window size.
  49.  
  50.     Peter Liljenberg
  51.  
  52. GT_Rer
  53.